﻿using System;
using ESoft.Extensions;
using NLog;

namespace ESoft.Logging
{
    /// <summary>
    /// NLog 日志输出者适配类
    /// </summary>
    public class Logging<T> : ILogging<T>
    {
        private readonly Logger _logger = LogManager.GetLogger(typeof(T).FullName);

        public void Debug(object message)
        {
            _logger.Debug(message);
        }

        public void Debug(string format, params object[] args)
        {
            _logger.Debug(format, args);
        }

        public void Error(object message)
        {
            _logger.Error(message);
        }

        public void Error(string format, params object[] args)
        {
            _logger.Error(format, args);
        }

        public void Error(object message, Exception exception)
        {
            _logger.Error(exception, message.ToJson());
        }

        public void Error(string format, Exception exception, params object[] args)
        {
            _logger.Error(exception, format, args);
        }

        public void Fatal(object message)
        {
            _logger.Fatal(message);
        }

        public void Fatal(string format, params object[] args)
        {
            _logger.Fatal(format, args);
        }

        public void Fatal(object message, Exception exception)
        {
            _logger.Fatal(exception, message.ToJson());
        }

        public void Fatal(string format, Exception exception, params object[] args)
        {
            _logger.Fatal(exception, format, args);
        }

        public void Info(object message)
        {
            _logger.Info(message);
        }

        public void Info(string format, params object[] args)
        {
            _logger.Info(format, args);
        }

        public void Trace(object message)
        {
            _logger.Trace(message);
        }

        public void Trace(string format, params object[] args)
        {
            _logger.Trace(format, args);
        }

        public void Warn(object message)
        {
            _logger.Warn(message);
        }

        public void Warn(string format, params object[] args)
        {
            _logger.Warn(format, args);
        }
    }
}